<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" charset="utf-8">
        //混合继承
        function Person(name,age) {
            this.name = name;
            this.age  = age;
        }
        Person.prototype.id = 10;
        Person.prototype.sayName = function () {
            alert(this.name);
        }
        function Boy(name,age,sex) {
            Person.call(this,name,age);
            this.sex = sex;
        }

        /**
         * 继承父类的原型对象
         * @type {Person}
         */
        Boy.prototype = new Person();
        var boy = new Boy('李四',20,'男');
        alert(boy.name);
        alert(boy.sex);
        alert(boy.age);
        alert(boy.id);
        boy.sayName();

    </script>
</head>
<body>
</body>
</html>